<template>
	<view class="kefuLogo" 
	@click="imgLink"
	:style="{
		right:pdRpx(right),
		bottom:pdRpx(bottom),
		width:imgWidth,
	}">
		<!-- #ifndef H5 -->
		<button v-if="configApi.kefuLink" open-type="contact" class="ioverlap"></button>
		<!-- #endif -->
		<u-image
		:width="pdRpx(imgWidth)"
		:height="pdRpx(imgHeight)" 
		:src="imgSrc"></u-image>
	</view>
</template>

<script>
	export default {
	  name: "index",
	  components: {
	    
	  },
		props: {
			imgSrc: {//图片路径
				type: [String],
				default:()=>{
					return '/static/comm/tel.png'
				}
			},
			imgWidth: {//图片宽度
				type: [String,Number],
				default:()=>{
					return '100rpx'
				}
			},
			imgHeight: {//图片高度
				type: [String,Number],
				default:()=>{
					return '100rpx'
				}
			},
			right: {//定位右间距
				type: [String,Number],
				default:()=>{
					return '20rpx'
				}
			},
			bottom: {//定位上间距
				type: [String,Number],
				default:()=>{
					return '400rpx'
				}
			},
			model: {//点击的模式
				type: [String,Number],
				default:()=>{
					return 1
				}
			},
		},
	  data() {
	    return {
				configApi:{},
	    };
	  },
	  mounted() {
	    this.configApi = this.$configApi
	  },
	  methods: {
			pdRpx(e){
				return e.indexOf('rpx') == -1 ? (e.indexOf('%') == -1 ? e + 'rpx' : e) : e
			},
			imgLink(){
				// #ifndef H5
				if(this.$configApi.kefuLink) return
				// #endif
				let serviceTel = uni.getStorageSync("configs").serviceTel;
				switch(this.model){
					case 1:
						if(this.$configApi.kefuLink) {
							window.location.href = this.$configApi.kefuLink
						}else{
							uni.makePhoneCall({
									phoneNumber:serviceTel || 4006688393,
							})
						}
						break;
				}
			},//点击
	  }
	};
</script>

<style lang="less" >
	.kefuLogo{
		position: fixed;
	}
</style>